package smetana.modules.ui.form.window;

import com.google.inject.Inject;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtkx.WTKX;
import smetana.modules.ui.actions.CreateDocumentAction;
import smetana.modules.ui.actions.DeleteDocumentAction;
import smetana.modules.ui.actions.EditDocumentAction;
import smetana.modules.ui.actions.ExportDocumentAction;
import smetana.modules.ui.actions.PrintDocumentAction;
import smetana.modules.ui.actions.SaveDocumentAction;
import smetana.modules.ui.form.AbstractPanel;

/**
 *
 * @author dmitry.mamonov
 */
public class ToolbarPanel extends AbstractPanel {
    //components
    @WTKX
    protected PushButton buttonCreate;
    @WTKX
    PushButton buttonEdit;
    @WTKX
    PushButton buttonSave;
    @WTKX
    PushButton buttonDelete;
    @WTKX
    PushButton buttonExport;
    @WTKX
    PushButton buttonPrint;
    //infrastructure
    @Inject
    CreateDocumentAction actionCreate;
    @Inject
    EditDocumentAction actionEdit;
    @Inject
    SaveDocumentAction actionSave;
    @Inject
    DeleteDocumentAction actionDelete;
    @Inject
    ExportDocumentAction actionExport;
    @Inject
    PrintDocumentAction actionPrint;

    public ToolbarPanel() {
        super();
    }

    @Override
    public void init() {
        buttonCreate.setAction(actionCreate);
        buttonEdit.setAction(actionEdit);
        buttonSave.setAction(actionSave);
        buttonDelete.setAction(actionDelete);
        buttonExport.setAction(actionExport);
        buttonPrint.setAction(actionPrint);
    }

    public PushButton getButtonSave() {
        return buttonSave;
    }

    public PushButton getButtonEdit() {
        return buttonEdit;
    }
}
